﻿using SelfManagement.Data.Constant;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SelfManagement.Web.Models.ViewModels.AccountModels
{
    public class RegisterModel
    {
        [Required]
        [Display(Name = "真实姓名")]
        [RegularExpression(pattern: ValidationConstant.TrueNameValReg, ErrorMessage = ValidationConstant.TrueNameValMessage)]
        public string TrueName { get; set; }

        [Display(Name = "邮箱")]
        [Remote("IsNotUserExists", "Common", ErrorMessage = "邮箱已被注册过")]
        [RegularExpression(pattern: ValidationConstant.EmailValReg, ErrorMessage = ValidationConstant.EmailValMessage)]
        public string Email { get; set; }

        [Display(Name = "手机")]
        [Remote("IsNotUserExists", "Common", ErrorMessage = "手机号已被注册过")]
        [RegularExpression(pattern: ValidationConstant.PhoneValReg, ErrorMessage = ValidationConstant.PhoneValMessage)]
        public string Phone { get; set; }

        [Required]
        [Display(Name = "用户名")]
        [Remote("IsNotUserExists", "Common", ErrorMessage = "用户名已被注册过")]
        [RegularExpression(pattern: ValidationConstant.UserNameValReg, ErrorMessage = ValidationConstant.UserNameValMessage)]
        public string UserName { get; set; }

        [Required]
        [Display(Name = "密码")]
        [RegularExpression(pattern: ValidationConstant.PasswordValReg, ErrorMessage = ValidationConstant.PasswordValMessage)]
        public string Password { get; set; }

        [Required]
        [Display(Name = "确认密码")]
        [RegularExpression(pattern: ValidationConstant.PasswordValReg, ErrorMessage = ValidationConstant.PasswordValMessage)]
        [System.ComponentModel.DataAnnotations.Compare("Password")]
        public string RPassword { get; set; }
    }
}